<template>
	<view>
		<view class="u-p-20 bg_FFFFFF">
			<view class="u-b-r-34 u-flex" style="background-color:#F3F3F3 ;padding-left: 20rpx;">
				<view class="u-h-30">
					<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img.png' width='28rpx' height='28rpx'></u-image>
				</view>

				<view class="u-p-l-10 u-w-600">
					<u-input type='text' v-model="params.keywords" @blur="searchBlur" :border='false'
						placeholder='请输入商品名称/订单编号'></u-input>
				</view>

			</view>
		</view>
		<u-tabs-swiper @change='change' ref="tabs" active-color='#FF5502' :list="list" :is-scroll="false"
			:current='current'></u-tabs-swiper>


		<!-- 待支付 -->
		<view class="u-p-20 " v-for="(item,index) in array" :key="index">
			<view class="bg_FFFFFF u-p-20 u-m-t-20 u-b-r-16">
				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;">
					<view class="u-flex">
						<view class="u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img1.png' width='36rpx' height='36rpx'></u-image>
						</view>
						<view class="u-p-l-10 u-weight u-h-36">{{item.shop_name}}</view>
						<view class="u-p-l-20 u-h-36">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img2.png' width='20rpx' height='20rpx'></u-image>
						</view>
					</view>
					<view class="u-font-20" style="color:#FF5502;" v-if="item.status==0">待支付</view>
					<view class="u-font-20" style="color:#FF5502;" v-if="item.status==2">待核销</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==3">待发货</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==4">待收货</view>
					<view class="u-font-20" style="color: #FC3533;" v-if="item.status==6">已完成</view>
				</view>

				<view class="u-p-20 u-flex u-row-between" style="border-bottom: 1rpx solid #F4F1F1;"
					@click="$u.route('/subcontract/scorechange/scoremassage/scoremassage?num='+item.id)"
					v-for="(items,index1) in item.item" :key="index1">
					<view class="u-flex">
						<view class="">
							<u-image :src='items.imgs[0]' width='183rpx' height='183rpx'></u-image>
						</view>
						<view class="u-p-l-30 ">
							<view class="u-weight">{{items.goods_name}}</view>
							<!-- <view class="u-weight u-p-t-10">可口30克*12枚</view> -->
							<view class="u-font-10  u-m-t-10">
								{{items.spece_content}}
							</view>
							<view class=" u-p-t-10 u-flex">
								<!-- <view class="u-h-30">
									<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/money.png" mode="aspectFill" width="23rpx"
										height='23rpx'></u-image>
								</view> -->
								<view class="u-font-20 u-m-l-10 u-m-t-10" style="color:#FF5502;">￥{{items.price}}</view>
							</view>
						</view>

					</view>
					<view class="u-font-20" style="color:#454545;">{{items.num}}</view>
				</view>

				<view class="u-p-20">

					<view class="u-flex u-font-20">
						<view class="" style="color: #68615F;">合计:</view>
						<view class=" u-h-50 u-flex">
							<view class="u-h-30 u-m-l-10">
								<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/money.png" mode="aspectFill" width="23rpx"
									height='23rpx'></u-image>
							</view>
							<view class="" style="color:#FF5502;">{{item.score_amount}}+￥{{item.pay_amount}}</view>
						</view>
					</view>



					<view class=" u-m-t-30">
						<u-row justify='end'>
							<u-col :span='3' v-if="item.status==0">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;" @click="change_address(item)">
									修改地址</view>
							</u-col>
							<!-- <u-col :span='3' v-if="item.status==0 || item.status==3">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FF5502;color: #FF5502;" @click="remove_good(item.id)">
									取消订单</view>
							</u-col> -->
							<u-col :span='3' v-if="item.status==0">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color:#FF5502;" @click="true_pay_money(item)">立即支付</view>
							</u-col>
							<u-col :span='3' v-if="item.status==3">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color:#FF5502;" @click="must_saves(item.id)">催发货</view>
							</u-col>
							<u-col :span='3' v-if="item.transport_type==1 && item.status>=4">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
									style="border: 1rpx solid #FC3533;color: #FC3533;"
									@click="$u.route(`/subcontract/originalprice/logistics/logistics?order_sn=${item.order_sn}`)">查看物流
								</view>
							</u-col>
							<u-col :span='3' v-if="item.status==2">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;" @click="selectScan(item)">查看二维码</view>
							</u-col>
							<u-col :span='3' v-if="item.status==4">
								<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center cl_FFF"
									style="background-color: #FC3533;" @click="true_get_good(item.id)">确认收货</view>
							</u-col>
						</u-row>
					</view>
				</view>
			</view>
		</view>
		<!-- 加载更多 -->
		<u-loadmore :status="status" icon-type="circle" margin-top="20" margin-bottom="20" />
		<!-- 修改地址弹窗 -->
		<u-mask :show="show1">
			<view class="u-w-600 u-b-r-20 bg_FFFFFF u-p-30 u-auto " style="margin-top: 200rpx;">

				<view class="u-flex u-row-between">
					<view>修改收货地址</view>
					<view class="" style="color: blue;" @click="$u.route('/pages/address/addressAll?num=1')">添加新地址
					</view>
				</view>

				<view class="u-p-30 u-m-t-30 u-b-r-20" @click="choes(item)" :class="num==item.id?'bgc1':'bgc'"
					v-for='item in address_list' :key="item.id">
					<view class="u-flex u-row-between ">
						<view class="">收货人:{{item.name}}</view>
						<view class="">{{item.phone}}</view>
					</view>

					<view class="u-m-t-10 u-font-20 u-p-b-20">{{item.addr}}</view>

					<view class="u-p-t-20 u-flex u-row-between" style="border-top: 1rpx solid #D7D7D7;">
						<view class="u-flex" v-if="item.is_default==1">
							<u-image src='https://www.sqkjkj.vip/wxImg/orderlist/img7.png' width='28rpx' height='28rpx'></u-image>
							<view class="u-m-l-10 u-font-20">默认地址</view>
						</view>
						<view class="" v-else></view>

					</view>
				</view>

				<view class="u-m-t-50 u-flex u-row-between">
					<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center" style="border: 1rpx solid blue;"
						@click="show1=false">取消</view>
					<view class="u-b-r-10 u-w-150 u-l-h-54 u-h-54 u-font-24 u-text-center"
						style="border: 1rpx solid #FC3533;color: #FC3533;" @click="true_change_address">确定</view>
				</view>
			</view>
		</u-mask>
		<u-popup v-model="shows" mode="bottom">
			<view class="bg_FFFFFF u-b-r-12">
				<view @click="pays='deposit'" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="u-flex">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/card.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">钱包支付</view>
						</view>
						<view class="u-m-l-30 cl_898989FF u-font-24">可用<text class="cl_FB473CFF">￥{{yu.user_wallet}}</text></view>
					</view>
					<view class="u-flex">
						<!-- <view class="u-m-r-20 cl_FB473CFF">-￥{{userinfo.goods_amount}}</view> -->
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='deposit'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>

				</view>

				<view @click="openEpayDialog" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="http://xcx.itcwc.com/wxImg/5dcf4786109a5.png" mode="aspectFill" width="50rpx" height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28">易支付</view>
						</view>

					</view>
					<view class="u-flex">
						<!-- <view class="u-m-r-20 cl_FB473CFF">-￥{{userinfo.goods_amount}}</view> -->
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays == 'epay'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>
				</view>

				<view @click="pays='wechat'" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/wx.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">微信支付</view>
						</view>

					</view>
					<view class="u-flex">
						<!-- <view class="u-m-r-20 cl_FB473CFF">-￥{{userinfo.goods_amount}}</view> -->
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='wechat'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>

					</view>

				</view>

				<!-- #ifdef APP-PLUS -->
				<view @click="pays='alipay'" class="u-flex u-row-between u-p-30" style="border-bottom: 1rpx solid #F6F6F6FF;">
					<view class="">
						<view class=" u-flex">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/zf.png" mode="aspectFill" width="50rpx"
								height='50rpx'>
							</u-image>
							<view class="u-m-l-30 u-font-28 ">支付宝支付</view>
						</view>

					</view>
					<view class="u-flex">
						<!-- <view class="u-m-r-20 cl_FB473CFF">-￥{{userinfo.goods_amount}}</view> -->
						<view class="">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c1.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-if="pays=='alipay'"></u-image>
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/c.png" mode="aspectFill" width="30rpx"
								height='30rpx' v-else>
							</u-image>
						</view>
					</view>

				</view>
				<!-- #endif -->

			</view>

			<!-- 立即支付 -->
			<view class=" u-h-120 u-w-750 bg_FFFFFF">
				<!-- <view class=" u-w-640 u-h-98 u-text-center">提交</view> -->
				<view @click="true_pays" class="u-w-640 u-auto u-h-98 bl2C_3F u-l-h-98 u-text-center u-b-r-20 u-auto"
					style="letter-spacing: 4rpx;color: #ffffff;">立即支付</view>
			</view>
		</u-popup>
		<!-- 查看二维码 -->
		<u-mask :show="show6">
			<view class="warp">
				<view class="u-w-650 u-b-r-20 bg_FFFFFF u-p-t-20 u-p-b-40">
					<view @click="show6 = false" class="u-p-20 u-text-right">
						<u-icon size="50" name="close-circle-fill"></u-icon>
					</view>
					<view class="u-font-26 u-text-center u-weight">
						请出示此码给商家核销，核销表示您已收到所购商品。
					</view>
					<view class="u-m-t-20">
						<u-image class="u-auto" :src='scanList.qrcode_url' width='600rpx' height='300rpx'
							mode="aspectFit"></u-image>
					</view>
				</view>
			</view>
		</u-mask>
		<u-popup v-model="shows1" mode='center'>
			<view class="u-p-30 u-h-200">
				<u-message-input :focus="true" :maxlength='6' @change="change" @finish="finish"></u-message-input>
			</view>

		</u-popup>
		<!-- 取消订单 -->
		<u-picker mode="selector" v-model="show4" :default-selector="[0]" :range="no_lick_list"
			@confirm='true_remove_good'></u-picker>
		<!-- 确认收货 -->
		<u-modal v-model="show7" content="请确认是否已经收到货" @confirm='true_get_good' :show-cancel-button='true'></u-modal>
		<u-toast ref="uToast" />
		<!-- 易支付选择弹窗 -->
		<u-popup v-model="showEpayDialog" mode="center" width="80%" border-radius="10">
			<view class="epay-dialog">
				<view class="epay-dialog-title">请选择支付方式</view>
				<view class="epay-dialog-content">
					<view class="epay-payment-option" @click="selectEpayMethod('wxpay')">
						<view class="radio-button">
							<view class="radio-inner" :class="{ 'radio-selected': params.epay_type === 'wxpay' }"></view>
						</view>
						<view class="payment-icon">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/wx.png" mode="aspectFill" width="40rpx"
								height='40rpx'></u-image>
						</view>
						<view class="payment-name">微信支付</view>
					</view>
					<view class="epay-payment-option" @click="selectEpayMethod('alipay')" v-if="!isWechatMP">
						<view class="radio-button">
							<view class="radio-inner" :class="{ 'radio-selected': params.epay_type === 'alipay' }"></view>
						</view>
						<view class="payment-icon">
							<u-image src="https://www.sqkjkj.vip/wxImg/common/shop/zf.png" mode="aspectFill" width="40rpx"
								height='40rpx'></u-image>
						</view>
						<view class="payment-name">支付宝支付</view>
					</view>
				</view>
				<view class="epay-dialog-footer">
					<view class="epay-dialog-btn cancel-btn" @click="showEpayDialog = false">取消</view>
					<view class="epay-dialog-btn confirm-btn" @click="confirmEpayMethod">确定</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>

<script>
export default {
	data() {
		return {
			// 查看发票
			show3: false,
			// 修改地址弹窗
			show1: false,
			// 是否为默认地址
			num: 0,
			// 申请售后弹窗
			show2: false,
			// 搜索的内容
			value: "",
			// 取消订单
			show4: false,
			no_lick_list: [],
			// 点击确定收货
			show7: false,
			// 状态切换
			current: '0',
			list: [{
				name: '全部',
				count: 0,
				type: -1
			}, {
				name: '待支付',
				count: 0,
				status: 0
			},
			{
				name: '待核销',
				count: 0,
				status: 2
			},
			{
				name: '待发货',
				count: 0,
				status: 3
			}, {
				name: '待收货',
				count: 0,
				status: 4
			}, {
				name: '已完成',
				count: 0,
				status: 6
			}
			],
			array: [],
			userinfo: '',
			address_list: [],
			order_id: '',
			shows: false,
			shows1: false,
			pays: '',
			params: {
				page: 1,
				page_size: 20,
				type: 1,
				status: 0,
				keywords: '',
				epay_type: 'wxpay',
				method: '',
			},
			status: 'loadmore',
			yu: '',
			scanList: [],
			show6: false,
			showEpayDialog: false,
			massage_pay: '',
			isWechatMP: false // 新增的WeChat Mini Program判断
		}
	},
	onLoad(obj) {
		this.current = obj.num
		this.params.status = this.list[this.current].status
		this.detectDeviceType()
	},
	onShow() {
		this.yu = uni.getStorageSync("userinfo")
		this.clear()
		this.massage()
		// 获取地址
		// this.get_address()
		this.changeaddress()
		// 获取取消原因
		this.no_licks()
	},
	// 下拉到底事件
	onReachBottom() {
		//避免多次触发
		if (this.status == 'loading' || this.status == 'nomore') {
			return;
		}
		if (this.list.length > 20) {
			this.massage();
		}
	},
	methods: {
		searchBlur() {
			this.clear()
			this.massage()
		},
		clear() {
			this.params.page = 1
			this.array = []
		},
		massage() {
			this.$api.people_pay_list(this.params, res => {
				if (res.data.code == 1) {
					if (res.data.data.data.length < 20) {
						this.status = 'nomore';
					} else {
						this.params.page = this.params.page + 1;
						this.status = 'loadmore';
					}
					this.array = this.array.concat(res.data.data.data);
					uni.stopPullDownRefresh();
				}
			})

		},
		//切换状态
		change(e) {
			this.current = e
			this.params.status = this.list[this.current].status
			this.clear()
			this.massage()
		},
		//取消原因弹窗
		no_licks() {
			this.$api.get_good_get({}, res => {
				console.log(res);
				this.no_lick_list = res.data.data
			})
		},
		// 点击取消订单
		remove_good(obj) {
			this.order_id = obj
			this.show4 = true
		},
		// 点击确定取消按钮
		true_remove_good(e) {
			console.log(e);
			// let arr=
			console.log(this.no_lick_list[e[0]]);
			this.$api.remove_pay_list_detal({
				order_id: this.order_id,
				order_cancel_cause: this.no_lick_list[e[0]],
				remark_reason: ''
			}, res => {
				console.log(res);
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '取消成功'
					})
					this.clear()
					this.massage()
					this.show5 = false
				} else {
					uni.showToast({
						icon: 'error',
						title: res.data.msg
					})
				}
			})
		},

		// 点击支付
		true_pay_money(item) {
			this.userinfo = item
			this.shows = true
		},
		// 点击立即支付
		true_pays() {
			if (this.pays == 'deposit') {
				// if (uni.getStorageSync('userinfo').have_trade_pwd == 0) {
				// 	uni.showModal({
				// 		title: '提示',
				// 		content: '请先设置余额支付密码',
				// 		success: (res) => {
				// 			if (res.confirm) {
				// 				this.$u.route('/pages/changePayPassword/changePayPassword')
				// 			} else {

				// 			}
				// 		}
				// 	})
				// 	return
				// }
				// this.shows1 = true
				this.pay()
			} else if (this.pays == 'epay') {
				// 易支付
				let params = {
					target_id: this.userinfo.target_id,
					target_type: 'order',
					pay_type: this.pays,
					// 如果是微信小程序，强制使用微信支付
					type: this.isWechatMP ? 'wxpay' : this.params.epay_type,
					method: this.params.method,

					client: 'APP',
					random: 1,
					// 根据不同平台设置不同的client参数
					// #ifdef APP-PLUS
					client: 'APP',
					// #endif
					// #ifdef MP-WEIXIN || MP-ALIPAY
					client: 'JSAPI',
					// #endif
					// #ifdef H5
					client: 'WAP',
					// #endif
				}
				this.$com.easyPay(params, this.pays);
			} else {
				// #ifdef APP-PLUS
				this.$com.wxPay({
					target_id: this.userinfo.target_id,
					target_type: 'order',
					pay_type: this.pays,
					client: "APP",
					trade_pwd: ''
				}, this.pays).then(ok => {
					this.$refs.uToast.show({
						title: ok.data.msg,
						type: 'success',
						callback: cal => {
							this.$u.route({
								type: 'reLaunch',
								url: '/pages/my/my'
							})
						}
					})
				})
				// #endif
				// #ifdef MP-WEIXIN
				this.$com.weChatPay({
					target_id: this.userinfo.target_id,
					target_type: 'order',
					pay_type: this.pays,
					client: "JSAPI",
					trade_pwd: ''
				}, this.pays).then(ok => {
					this.$refs.uToast.show({
						title: ok.msg,
						type: 'success',
						callback: cal => {
							this.$u.route({
								type: 'reLaunch',
								url: '/pages/my/my'
							})
						}
					})
				})
				// #endif
			}
		},

		finish(e) {
			// console.log('输入结束，当前值为：' + e);
			this.pay(e)
			this.shows1 = false
		},
		pay(obj = '') {
			uni.showLoading({
				title: '支付中',
				mask: true
			});
			this.$api.go_pay({
				target_id: this.userinfo.target_id,
				target_type: 'order',
				pay_type: this.pays,
				client: "APP",
				trade_pwd: obj
			}, res => {
				uni.hideLoading();
				console.log(res);
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '支付成功'
					})
					setTimeout(() => {
						uni.switchTab({
							url: '/pages/my/my'
						})
					}, 500)

				} else {
					uni.showToast({
						icon: 'none',
						title: res.data.msg
					})
				}
			})

		},
		// 获取地址
		changeaddress() {

			this.$api.my_address_list({
				page: 1,
				page_size: 20
			}, res => {
				// console.log(res);
				if (res.data.code == 1) {
					this.address_list = res.data.data.data

					console.log(this.address_list);
					for (var i = 0; i < this.address_list.length; i++) {
						let arr = this.address_list[i].modify_region.name
						arr = arr.split('/')
						this.address_list[i].modify_region.name = arr[0] + arr[1] + arr[2] + '-' + this
							.address_list[i].addr
						this.address_list[i].addr = this.address_list[i].modify_region.name

					}
				}
			})
		},
		selectScan(item) {
			this.$api.order_finish_after_verification_qrcode({
				order_sn: item.order_sn
			}, res => {
				if (res.data.code == 1) {
					this.scanList = res.data.data
					this.show6 = true
				}
			})
		},
		// 点击切换地址
		choes(item) {
			this.num = item.id
			this.userinfo.address_id = item.id
		},
		// 点击编辑地址
		change_address(obj) {
			this.num = obj.address_id
			this.userinfo = obj
			this.show1 = true

		},
		// 点击确定更换地址
		true_change_address() {
			this.$api.change_address({
				order_id: this.userinfo.id,
				address_id: this.userinfo.address_id
			}, res => {
				console.log(res);
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'none',
						title: '修改成功'
					})
					this.show1 = false
				} else {
					uni.showToast({
						icon: 'none',
						title: res.data.msg
					})
				}
			})
		},
		// 点击确认收货按钮
		true_get() {
			this.show5 = true
		},
		// 点击催发货
		must_saves(obj) {
			this.$api.must_save({
				order_id: obj
			}, res => {
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'none',
						title: '已通知商家，尽快发货'
					})
				} else {
					uni.showToast({
						icon: 'none',
						title: res.data.msg
					})
				}
			})
		},
		// 点击确认收货
		true_get_good(order_id) {
			this.$api.true_pay_list_detal({
				order_id: order_id
			}, res => {
				if (res.data.code == 1) {
					uni.showToast({
						icon: 'success',
						title: '收货成功'
					})
					this.clear()
					this.massage()
					this.show5 = false
				} else {
					uni.showToast({
						icon: 'error',
						title: res.data.msg
					})
				}
			})
		},
		// 保存图片
		save() { },
		selectEpayMethod(type) {
			this.pays = type
			this.showEpayDialog = false
		},
		confirmEpayMethod() {
			this.showEpayDialog = false
		},
		openEpayDialog() {
			this.pays = 'epay'
			this.showEpayDialog = true
		},
		detectDeviceType() {
			// #ifdef H5
			this.params.method = 'web' // H5环境使用web
			this.isWechatMP = false
			// #endif

			// #ifdef MP-WEIXIN
			this.params.method = 'jsapi' // 微信小程序环境使用jsapi
			this.isWechatMP = true
			// #endif

			// #ifdef MP-ALIPAY
			this.params.method = 'jsapi' // 支付宝小程序环境使用jsapi
			this.isWechatMP = false
			// #endif

			// #ifdef APP-PLUS
			this.params.method = 'web' // APP环境使用app
			this.isWechatMP = false
			// #endif

			console.log('当前设备类型:', this.params.method)
			console.log('是否为微信小程序:', this.isWechatMP)
		}
	}
}
</script>

<style scoped>
page {
	background: #f5f5f5;
}

.bgc {
	background: #F4F4F4;
}

.bgc1 {
	background: #FFF2F2;
	border: 1rpx solid #FC3533;
}

.error {
	width: 74rpx;
	height: 160rpx;
	background: url('https://www.sqkjkj.vip/wxImg/common/home/img12.png') no-repeat;
	background-size: 100% 100%;
}

/* 易支付选择弹窗样式 */
.epay-dialog {
	background-color: #fff;
	padding: 30rpx;
}

.epay-dialog-title {
	font-size: 32rpx;
	font-weight: bold;
	text-align: center;
	margin-bottom: 30rpx;
}

.epay-dialog-content {
	padding: 20rpx 0;
}

.epay-payment-option {
	display: flex;
	align-items: center;
	padding: 20rpx 0;
	border-bottom: 1rpx solid #f5f5f5;
}

.radio-button {
	width: 36rpx;
	height: 36rpx;
	border-radius: 50%;
	border: 2rpx solid #ddd;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-right: 20rpx;
}

.radio-inner {
	width: 20rpx;
	height: 20rpx;
	border-radius: 50%;
	background-color: transparent;
}

.radio-selected {
	background-color: #3298FD;
}

.payment-icon {
	margin-right: 20rpx;
}

.payment-name {
	font-size: 28rpx;
}

.epay-dialog-footer {
	display: flex;
	justify-content: space-between;
	margin-top: 40rpx;
}

.epay-dialog-btn {
	width: 45%;
	height: 80rpx;
	border-radius: 40rpx;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 28rpx;
}

.cancel-btn {
	background-color: #f5f5f5;
	color: #666;
}

.confirm-btn {
	background-color: #3298FD;
	color: #fff;
}
</style>
